const express = require("express");
const router = express.Router();
const db = require("../db/index.js");

router.get("/userinfo",(req,res)=>{
    const id = req.user.id;
    const sql = "select id,username,status from db_users where id = ? ";
    db.query(sql,id,(err,result)=>{
        if(err) return res.cc(err);
        if(result.length>1 || result.length==0) return res.cc("用户认证失败");
        res.send({
            status:0,
            message:"用户信息获取成功",
            data:result[0].username
        })
    })
})





module.exports = router;